package com.hua.nailcampus.auth;

import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * @Author:chenjianhua
 * @Date:2023/11/22 10:25
 * @Version 1.8
 */
@Configuration
public class LoginMvcConfigurerAdapter extends WebMvcConfigurationSupport {

    @Resource
    private RedisTemplate redisTemplate;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(
                new UserLoginInterceptor(redisTemplate)
        ).addPathPatterns("nailCampus/**")
                .excludePathPatterns("nailCampus/index/login");
        super.addInterceptors(registry);
    }

}
